package chixing.day08.work;
public class MyStudent {
    private String name;
    private double score;
    private static int totalStudents = 0;
    private static double totalScore = 0;

    // 构造方法
    public MyStudent(String name, double score) {
        this.name = name;
        this.score = score;
        totalStudents++;
        totalScore += score;
    }

    // 获取平均分的静态方法
    public static double getAverageScore() {
        if (totalStudents == 0) {
            return 0;
        }
        return totalScore / totalStudents;
    }

    // 获取学生信息
    public String getStudentInfo() {
        return "学生姓名: " + name + ", 分数: " + score;
    }
}